#include "gooverstack.h"
void STPush(ST* ps, STDatatype x)
{
	assert(ps);

	if (ps->capacity = ps->top+1)
	{
		int newcapacity = ps->capacity == 0 ? 4 : 2 * ps->capacity;
		STDatatype* temp = (STDatatype*)realloc(ps->a, maxsize * sizeof(ps->capacity));
		if (temp == NULL)
		{
			return perror("realloc fail");
		}
		ps->a = temp;
		ps->capacity = newcapacity;
		ps->top = newcapacity - 1;
	}
	ps->a[ps->top];
	ps->top++;
}

void STPush(ST* ps, STDatatype x)
{
	assert(ps);
	if (ps->capacity == ps->top + 1)
	{
		int newcapacity = ps->capacity == 0 ? 4 : 2 * sizeof(ps->capacity);
		int* temp = (int*)realloc(ps->a, maxsize * sizeof(ps->capacity));
		if (temp == NULL)
		{
			perror("realloc fail");
		}
		ps->capacity = newcapacity;
		ps->a = temp;
		ps->top++;
	}
	ps->a[ps->top] = x;
	ps->top++;
}
